package org.gm.config;

import org.gm.runnable.MinerRunnable;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

@Component
public class SchedulerConfig {
    public static final Map<String, MinerRunnable> minerRunnableMap = new ConcurrentHashMap<>();

    @Value("${scheduler.number}")
    private Integer number;

    @Bean
    public ExecutorService getExecutors() {
        return Executors.newFixedThreadPool(number);
    }
}
